#pragma once
#include <functional>

enum SIGN
{
	SIGN_EQ,		// ==
	SIGN_NE,		// !=
	SIGN_GT,		// >
	SIGN_LT,		// <
};

enum FEATURE
{
	FEATURE_NAME,
	FEATURE_JOB,
	FEATURE_WORK,
	FEATURE_SCORE,
};

typedef std::function<string(string, FEATURE)> GetFeature;

class Rule
{
public:
	virtual bool Check(GetFeature func) = 0;
};

class BoolRule : public Rule
{
public:
	BoolRule(FEATURE f, SIGN s, int p)
	{
		feature = f;
		sign = s;
		param = p;
	}

	virtual bool Check(GetFeature func)
	{
		//string feature = func(feature);
		return true;
	}
private:
	FEATURE feature;
	SIGN sign;
	int param;
};

class RelationRule : public Rule
{
public:
	RelationRule(FEATURE fa, FEATURE fb, SIGN s, int p)
	{
		featureA = fa;
		featureB = fb;
		sign = s;
		param = p;
	}

	virtual bool Check(GetFeature func)
	{
		return true;
	}
private:
	FEATURE featureA, featureB;
	SIGN sign;
	int param;
};

class RuleSet
{
public:
	void AddRule(Rule* r)
	{
		rules.push_back(r);
	}

	bool Check(GetFeature f)
	{
		for (auto& r : rules)
		{
			if (r->Check(f))
			{
				return false;
			}
		}
		return true;
	}

private:
	vector<Rule*> rules;
};